package com.example.design.patterns.geekbang.创建型.单例模式.替代方案.单机;

/**
 * 第二种解决思路是：将参数放到 getIntance() 方法
 */
public class Singleton2 {
    private static Singleton2 instance = null;
    private final int paramA;
    private final int paramB;

    private Singleton2(int paramA, int paramB) {
        this.paramA = paramA;
        this.paramB = paramB;
    }

    public synchronized static Singleton2 getInstance(int paramA, int paramB) {
        if (instance == null) {
            instance = new Singleton2(paramA, paramB);
        }
        return instance;
    }
}

// Singleton2 singleton2 = Singleton2.getInstance(10, 50);